home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / replymsg.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  105 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: replymsg.c,v 1.5 1996/10/24 15:50:57 aros Exp $
  4.     $Log: replymsg.c,v $
  5.     Revision 1.5  1996/10/24 15:50:57  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:56:08  digulla
  9.     Replaced AROS_LA by AROS_LHA
  10.     Replaced some AROS_LH*I by AROS_LH*
  11.     Sorted and added includes
  12.  
  13.     Revision 1.3  1996/08/01 17:41:18  digulla
  14.     Added standard header for all files
  15.  
  16.     Desc:
  17.     Lang: english
  18. */
  19. #include "exec_intern.h"
  20. #include <aros/libcall.h>
  21.  
  22. /*****************************************************************************
  23.  
  24.     NAME */
  25.     #include <exec/ports.h>
  26.     #include <clib/exec_protos.h>
  27.  
  28.     AROS_LH1(void, ReplyMsg,
  29.  
  30. /*  SYNOPSIS */
  31.     AROS_LHA(struct Message *, message, A1),
  32.  
  33. /*  LOCATION */
  34.     struct ExecBase *, SysBase, 63, Exec)
  35.  
  36. /*  FUNCTION
  37.     Send a message back to where it came from. It's generally not
  38.     wise to access the fields of a message after it has been replied.
  39.  
  40.     INPUTS
  41.     message - a message got with GetMsg().
  42.  
  43.     RESULT
  44.  
  45.     NOTES
  46.  
  47.     EXAMPLE
  48.  
  49.     BUGS
  50.  
  51.     SEE ALSO
  52.     WaitPort(), GetMsg(), PutMsg()
  53.  
  54.     INTERNALS
  55.  
  56.     HISTORY
  57.  
  58. ******************************************************************************/
  59. {
  60.     AROS_LIBFUNC_INIT
  61.  
  62.     struct MsgPort *port;
  63.  
  64.     /* Protect the message against access by other tasks. */
  65.     Disable();
  66.  
  67.     /* Get replyport */
  68.     port=message->mn_ReplyPort;
  69.  
  70.     /* Not set? Only mark the message as no longer sent. */
  71.     if(port==NULL)
  72.     message->mn_Node.ln_Type=NT_FREEMSG;
  73.     else
  74.     {
  75.     /* Mark the message as replied */
  76.     message->mn_Node.ln_Type=NT_REPLYMSG;
  77.  
  78.     /* Add it to the replyport's list */
  79.     AddTail(&port->mp_MsgList,&message->mn_Node);
  80.  
  81.     /* And trigger the arrival action. */
  82.     switch(port->mp_Flags&PF_ACTION)
  83.     {
  84.         case PA_SIGNAL:
  85.         /* Send a signal */
  86.         Signal((struct Task *)port->mp_SigTask,1<<port->mp_SigBit);
  87.         break;
  88.  
  89.         case PA_SOFTINT:
  90.         /* Raise a software interrupt */
  91.         Cause((struct Interrupt *)port->mp_SoftInt);
  92.         break;
  93.  
  94.         case PA_IGNORE:
  95.         /* Do nothing */
  96.         break;
  97.     }
  98.     }
  99.  
  100.     /* All done */
  101.     Enable();
  102.     AROS_LIBFUNC_EXIT
  103. }
  104.  
  105.